/*
 DLRecyclingDepotLocatorViewController.h
 Date Created: February 23, 2010
 
 Author: Karol Krizka <kkrizka@gmail.com>
 
 Copyright (C) 2010 Green-Power
 
 URL: http://code.google.com/p/green-power
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 3 of the License, or
 (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 $Id$
 */

#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>

#import "DLGoogleLocalQuery.h"

/**
 * Manages the view that displays the map and upates the list of recycling 
 * depots.
 * 
 * It is responsible for error handling, manual location finding, updaing 
 * using CoreLocation and quering Google Local Search
 */
@interface DLRecyclingDepotLocatorViewController : UIViewController<CLLocationManagerDelegate,DLGoogleLocalQueryDelegate,MKMapViewDelegate>  {
  CLLocationManager *locationManager;
  
  MKMapView *mapView;
  
  BOOL initialized;
  
  DLGoogleLocalQuery *returnItQuery;
  DLGoogleLocalQuery *changesQuery;
  DLGoogleLocalQuery *bottleDepotQuery;
  
  NSSet *depotList;
}

@property (nonatomic,retain) IBOutlet MKMapView *mapView;

/**
 * Called when the user should be given control of changing the map. This
 * function should be called only once (although no checks are made to enforce
 * this), when everything is set up.
 *
 * It also changes the value of |initialized| to YES.
 */
- (void)giveUserControl;

/**
 * Called when the location services fail. This pops up an alert box informing
 * the user that there were problems, and that he has to located himself
 * manually.
 *
 * This is executed only once, as determined by the |initialized| variable.
 */
- (void)alertManualLocation;

/**
 * New location has been determined in some way, either manually or using
 * CoreLocation. Update everything.
 *
 * \param location The new location
 */
- (void)handleNewLocation:(CLLocationCoordinate2D)location;

@end
